package injections;

/**
 * Created by rehak on 2/17/14.
 */
public class PropertyValue {

    private final Object val;

    public PropertyValue(Object val) {
        this.val = val;
    }

    public Object getVal() {
        return val;
    }

    public boolean isValue() {
        return !isReference();
    }

    public boolean isReference() {
        return val instanceof DefinedClass;
    }

    public DefinedClass getAsReference() {
        if (val instanceof DefinedClass) {
            return (DefinedClass) val;
        } else {
            throw new RuntimeException("Unable to get value as defined class, is " + val);
        }
    }

}
